import java.util.Scanner;
public class TheSnakeArray {
    //题目描述，蛇形打印数组
    //示例如下:输入:3
    //打印    1  2  3
    //       8  9  4
    //       7  6  5
    static int i=1;
    public static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);
        int num=scan.nextInt();
        int[][] matrix=new int[num][num];
        int rowSta=0,colSta=0;
        int rowEnd=num-1,colEnd=num-1;
        while(rowSta<=rowEnd&&colSta<=colEnd) {
            int r = rowSta, c = colSta;
            //输入上面一行
            while (c <= colEnd) {
                matrix[r][c++] = i++;
            }
            //恢复
            c = colEnd;
            r++;
            //输入右边一列
            while (r <= rowEnd) {
                matrix[r++][c] = i++;
            }
            //恢复
            r = rowEnd;
            c--;
            //输入下面一行
            while (c >= rowSta) {
                matrix[r][c--] = i++;
            }
            //恢复
            c = colSta;
            r--;
            //输入左边一列
            while (r > rowSta) {
                matrix[r--][c] = i++;
            }
            rowSta++;
            colSta++;
            rowEnd--;
            colEnd--;
        }
        for (int i = 0; i < matrix.length; i++) {
            for (int j = 0; j < matrix[i].length; j++) {
                System.out.print(matrix[i][j] + " ");
            }
            System.out.println();
        }
    }
}
